public class demo32 {
    public boolean canConstruct(String ran, String mag) {
        String[] s1 = mag.split(ran,2);
        for(int i = 0;i<s1.length;i++)
            if(s1[i].equals(ran)) return true;
        return false;
    }

    public static void main(String[] args) {
        demo32 d1 = new demo32();
        d1.canConstruct("abcd","abcdefabcd");
    }
}
